package io1;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * 使用对象输入流进行对象的反序列化;
 * 反序列化:将一组字节还原为Java对象
 */
public class OISDemo {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        FileInputStream fis = new FileInputStream("student.txt");
        ObjectInputStream ois = new ObjectInputStream(fis);
        Object ob=ois.readObject();
        Student stu =(Student)ob;
        System.out.println(stu);
        System.out.println("读入完毕");
        ois.close();
    }
}
